const crypto = window.require('crypto')
const uuidv4 = window.require('uuid/v4')

module.exports = function(uuid) {
  if (typeof uuid === typeof true && uuid) {
    return uuidv4()
  }
  const length = 10
  return crypto.randomBytes(length).toString('hex')
}
